var xmlHttp;

setInterval ( "checkPM()", 360000 );
checkPM();

function checkPM()
{ 
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
 {
 // alert ("Browser does not support HTTP Request");
 return;
 } 
var url="./pms/checkPM.php";
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
xmlHttp.onreadystatechange=stateChanged; 

}


function stateChanged() 
{ 
 if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 {
   var rsp = xmlHttp.responseText;
   if (rsp.length>5 && rsp.substr(0,4)=="<img")
   {
	   if (document.getElementById("newPM")) 
	   { 
	     document.getElementById("newPM").innerHTML=rsp;
	   }
	   alert ("You have got new PM.");
	 }
   
 } 
}

function GetXmlHttpObject()
{
	var xmlHttp=null;
	
	try
	 {
	 // Firefox, Opera 8.0+, Safari
	 xmlHttp=new XMLHttpRequest();
	 }
	catch (e)
	 {
	 // Internet Explorer
	 try
	  {
	  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
	  }
	 catch (e)
	  {
	  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	 }
	return xmlHttp;
}



